package com.atguitu.campus.renwendemo.Controller;

import com.atguitu.campus.renwendemo.dto.AuthDto;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
public class HelloController {

    @RequestMapping("/hello")
    public String say(){
        return "Hello World";
    }
    @RequestMapping("/list/{name}")
    public List<String> list(@PathVariable String name){
        List<String> list = new ArrayList<String>();
        list.add("zhangsan");
        list.add("lisi");
        list.add(name);
        return list;
    }

    @RequestMapping("/add")
    public List<String> add(@RequestBody AuthDto authDto){
        List<String> list = new ArrayList<String>();
        list.add("zhangsan");
        list.add("lisi");
        list.add(authDto.getUsername());
        return list;
    }

}
